package cn.alexy.dbbench.server.mongo.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;
 

@Document(collection = "result") 
public class Result {

	@Id
	private long id;
	private String ids;
	private String driver;
	private String dbms;
	private String adapter;
	private int datacount;
	private Long addtime;
	private Long edittime;
	private Long sumtime;
	private Long querytime;
	private Long deltime;
	private Long emptytime;
	private Date benchdate;
	private String comm;
	private Long addmark;
	private Long editmark;
	private Long summark;
	private Long querymark;
	private Long delmark;
	private Long emptymark;
	private Long totalmark;
	private String vendor;
	

	public String getDbms() {
		return dbms;
	}
	public void setDbms(String dbms) {
		this.dbms = dbms;
	}
	public String getAdapter() {
		return adapter;
	}
	public void setAdapter(String adapter) {
		this.adapter = adapter;
	}
	public int getDatacount() {
		return datacount;
	}
	public void setDatacount(int datacount) {
		this.datacount = datacount;
	}
	public Long getAddtime() {
		return addtime;
	}
	public void setAddtime(Long addtime) {
		this.addtime = addtime;
	}
	public Long getEdittime() {
		return edittime;
	}
	public void setEdittime(Long edittime) {
		this.edittime = edittime;
	}
	public Long getSumtime() {
		return sumtime;
	}
	public void setSumtime(Long sumtime) {
		this.sumtime = sumtime;
	}
	public Long getDeltime() {
		return deltime;
	}
	public void setDeltime(Long deltime) {
		this.deltime = deltime;
	}
	public Date getBenchdate() {
		return benchdate;
	}
	public void setBenchdate(Date benchdate) {
		this.benchdate = benchdate;
	}
	public String getComm() {
		return comm;
	}
	public void setComm(String comm) {
		this.comm = comm;
	}

	public String getDriver() {
		return driver;
	}

	public void setDriver(String driver) {
		this.driver = driver;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public Long getAddmark() {
		return addmark;
	}

	public void setAddmark(Long addmark) {
		this.addmark = addmark;
	}

	public Long getEditmark() {
		return editmark;
	}

	public void setEditmark(Long editmark) {
		this.editmark = editmark;
	}

	public Long getSummark() {
		return summark;
	}

	public void setSummark(Long summark) {
		this.summark = summark;
	}

	public Long getDelmark() {
		return delmark;
	}

	public void setDelmark(Long delmark) {
		this.delmark = delmark;
	}

	public Long getTotalmark() {
		return totalmark;
	}

	public void setTotalmark(Long totalmark) {
		this.totalmark = totalmark;
	}
	
	public String getVendor() {
		return vendor;
	}

	public void setVendor(String vendor) {
		this.vendor = vendor;
	}

	public Long getQuerytime() {
		return querytime;
	}

	public void setQuerytime(Long querytime) {
		this.querytime = querytime;
	}

	public Long getEmptytime() {
		return emptytime;
	}

	public void setEmptytime(Long emptytime) {
		this.emptytime = emptytime;
	}

	public Long getQuerymark() {
		return querymark;
	}

	public void setQuerymark(Long querymark) {
		this.querymark = querymark;
	}

	public Long getEmptymark() {
		return emptymark;
	}

	public void setEmptymark(Long emptymark) {
		this.emptymark = emptymark;
	}

	public void fillmark() {
		final Long ADD = 1318L;
		final Long EDIT = 3898L;
		final Long SUM = 31687L;
		final Long QUERY = 8353L;
		final Long DEL = 5402L;
		
		

//		this.addmark = (this.datacount * ADD * 1000) / (this.addtime * 10000);
//		System.out.println(this.addmark);
//
//		this.editmark = (this.datacount * EDIT * 1000)
//				/ (this.edittime * 10000);
//		System.out.println(this.editmark);
//
//		this.delmark = (this.datacount * DEL * 1000) / (this.deltime * 10000);
//		System.out.println(this.delmark);
//
//		this.summark = (this.datacount * SUM * 1000) / (this.sumtime * 10000);
//		System.out.println(this.summark);
//
//		this.totalmark = ((this.addmark * 30) + (this.editmark * 30) + (this.summark * 30) + (this.delmark * 10)) / 100;
//		System.out.println(this.totalmark);
		
//		org.hibernate.dialect.
		
		this.addtime = (this.datacount * 1000) / this.addtime;
		this.edittime = (this.datacount * 1000) / this.edittime;
		this.sumtime = (this.datacount * 1000) / this.sumtime;
		this.querytime = (this.datacount * 1000) / this.querytime;
		this.deltime = (this.datacount * 1000) / this.deltime;
		
		this.addmark = (this.addtime * 1000) / ADD;
		System.out.println(this.addmark);
		
		this.editmark = (this.edittime * 1000) / EDIT;
		System.out.println(this.editmark);
		
		this.summark = (this.sumtime * 1000) / SUM;
		System.out.println(this.summark);
		
		this.querymark = (this.querytime * 1000) / QUERY;
		System.out.println(this.querymark);
		
		this.delmark = (this.deltime * 1000) / DEL;
		System.out.println(this.delmark);

		this.totalmark = ((this.addmark * 30) + (this.editmark * 30) + (this.querymark * 25) + (this.summark * 5) + (this.delmark * 10)) / 100;
		System.out.println(this.totalmark);

	}

	@Override
	public String toString() {
		return "Result [ids=" + ids + ", driver=" + driver + ", dbms=" + dbms
				+ ", adapter=" + adapter + ", datacount=" + datacount
				+ ", addtime=" + addtime + ", edittime=" + edittime
				+ ", sumtime=" + sumtime + ", querytime=" + querytime
				+ ", deltime=" + deltime + ", emptytime=" + emptytime
				+ ", benchdate=" + benchdate + ", comm=" + comm + ", addmark="
				+ addmark + ", editmark=" + editmark + ", summark=" + summark
				+ ", querymark=" + querymark + ", delmark=" + delmark
				+ ", emptymark=" + emptymark + ", totalmark=" + totalmark
				+ ", vendor=" + vendor + "]";
	}

}
